﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using BLL;
using Function;
using System.Data;

namespace UI.Module.User
{
    public partial class UserMsge : System.Web.UI.Page
    {
        protected ST_Investor model;
        protected void Page_Load(object sender, EventArgs e)
        {
            model = new ST_InvestorBLL().GetModel(Method.CurrentUserID);

            if (model != null)
            {
                if (model.Type == 1)
                {
                    //个体
                    this.div_Individual.Attributes.CssStyle.Add("display", "block");
                }
                else
                {
                    //经营体
                    this.div_Management.Attributes.CssStyle.Add("display", "block");
                }
                StringBuilder sb = new StringBuilder();
                DataSet pact = new ST_InvestorPactBLL().GetList("InvestorID=" + Method.CurrentUserID);
                if (pact != null)
                {
                    foreach (DataRow item in pact.Tables[0].Rows)
                    {
                        sb.Append("<li><span>" + item["PactTitle"].ToString() + "</span><a target='_blank' href='InvestorPact.aspx?pactID=" + item["ID"].ToString() + "'>点击查看详情</a></li>");
                    }
                }
                else
                {
                    sb.Append("<li><span>暂无合同信息</span></li>");
                }
                ul_InvestorPact.InnerHtml = sb.ToString();
            }
            else {
                MessageBox_Page McBx = new MessageBox_Page();//实例化对话框
                string RemarkString;
                RemarkString = "未找到对象";

                McBx.Title = "系统提示";
                McBx.AddContent(RemarkString);
                McBx.Type = MsgType.Error;
                McBx.AddUrl("返回", "../../Index.aspx", UrlType.Href);
                MessageEvent.MessageBox(McBx, "../../ErrorPage/ShowMsg.aspx");
            }
        }
    } 
}